<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page language="java" import="com.server.web.JsVersionUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title>角色修改</title>
		<link rel="stylesheet" href='<c:url value="/share/pintuer.css"></c:url>'>
		<link rel="stylesheet" href='<c:url value="/share/admin.css"></c:url>' >
		<script type="text/javascript" src='<c:url value="/js/jquery.js"></c:url>' ></script>
		<script type="text/javascript" src='<c:url value="/js/pintuer.js"></c:url>'></script>
		<script type="text/javascript" src='<c:url value="/js/admin.js"></c:url>'></script>
		<script type="text/javascript" src='<c:url value="/js/layer.js"></c:url>'></script>
		<script
	src='<c:url value="/js/rqfui/rqfui.js"></c:url>?v=<%=JsVersionUtil.CURRENT_VERSION%>'></script>
	</head>

	<body>
		<!--内容-->
			<form class="form-x">
			<div class="form-group">
				<div class="label"><label for="describe">新密码</label></div>
				<div class="field">
					<input type="text" class="input input-small" style="width:300px" name="password" size="30"  data-validate="required:请填写新密码,length#>=1:密码长度不符合要求"/>
				</div>
			</div>
			<div class="form-group">
				<div class="label"><label for="describe" >重复密码</label></div>
				<div class="field">
					<input type="text" class="input input-small" style="width:300px"  name="repassword" size="30" data-validate="required:必填"/>
				</div>
			</div>
			</div>
			<div class="form-button">
			<button class="button" id="add" type="button">修改</button>
			</div>
			</form>

		<!--底部-->
		<script>
		function check_from(){
			   if($("input[name=password]").val()=="" || $("input[name=password]").val()==null){
				   $("input[name=password]").parent().append('<div class="input-help"><ul><li><font color="red">请输入新密码</font></li></ul></div>');
				   return false;
			   }
			   if($("input[name=password]").val()!=$("input[name=repassword]").val()){
				   $("input[name=repassword]").parent().append('<div class="input-help"><ul><li><font color="red">两次密码不一致</font></li></ul></div>');
				   return false;
			   }
			   
			   return true;
		    }
				$("#add").click(function(){
					if(check_from()){
						$.ajax({
							url:      "<c:url value='/admin/save'></c:url>",
							type:     "post",
							dataType: "json",
							data:     {
								"password":$("input[name=password]").val(),
							},
							success: function(json){
								if(json.isSuccess){
									top.commonTools.showTip("修改成功！", 2);
									location.href="<c:url value='/mngindex'></c:url>";
								}else{
									top.commonTools.showTip("修改失败！", 2);
								}
							}
						}); 
					}
				});
		</script>
	</body>

</html>